
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import rootReducer from '@reducers'
import { logger, router, reduxRouterMiddleware } from './index'

const nextReducer = require('./reducers')

export default function configure(initialState) {
    // console.log('initialState', initialState)
    const create = window.devToolsExtension
        ? window.devToolsExtension()(createStore)
        : createStore

    const createStoreWithMiddleware = applyMiddleware(
        reduxRouterMiddleware,
        thunkMiddleware,
        logger,
        // router,
    )(create)
    return createStoreWithMiddleware(rootReducer, initialState)
}
